
from pages.base_page import BasePage
from selenium.webdriver.common.by import By

class BusinessRecycleBinPage(BasePage):
    url = "/crm/index.php?m=business&a=index&by=deleted"
    result_locator = (By.XPATH, '/html/body/div[5]/div[2]')
    error_locator =(By.XPATH,"/html/body/div/form/fieldset/div[1]")
    check_frist_locator = (By.XPATH,'//*[@id="form1"]/table/tbody/tr/td[1]/input')
    delete_locator = (By.ID,'delete')

    def click_check_frist(self):
        """
        选择所有
        """
        self.find_element(self.check_frist_locator).click()

    def click_delete(self):
        self.find_element(self.delete_locator).click()

#返回增删改查后的提示信息
    def get_result_tips(self):
        return self.find_element(self.result_locator).text

#返回弹窗文本信息
    def get_alert_text(self):
        return self.driver.switch_to.alert.text

#返回报错弹窗文本信息
    def get_error_text(self):
        return self.find_element(self.error_locator).text

